<html>
<head>
<script>
function testRects()
{
    if (!window.testRunner || !window.eventSender || !window.internals)
        return;
    testRunner.dumpAsText();

    var range = document.createRange();
    range.selectNode(document.getElementById('div'));
    var rectList = range.getClientRects();
    var rect = rectList[0];

    internals.setPageScaleFactor(2);
    var scaledRange = document.createRange();
    scaledRange.selectNode(document.getElementById('div'));
    var scaledRectList = scaledRange.getClientRects();
    var scaledRect = scaledRectList[0];

    var result = document.getElementById("result");
    if (rect.width && rect.height &&
        rect.left == scaledRect.left &&
        rect.top == scaledRect.top &&
        rect.right == scaledRect.right &&
        rect.bottom == scaledRect.bottom)
        result.innerHTML = "Pass";
    else
        result.innerHTML = "Fail";
}
</script>
</head>

<body onload="testRects();">
    <div id="div" style="width:100px; height:100px; background-color:green;"></div>
    <p id="result">This test must be run via DumpRenderTree.</p>
</body>
</html>
